﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using myTwitter.BO;
using System.Windows.Documents;
using myTwitter.BO.Search;

namespace myTwitter.API
{
    public delegate void DirectMessagesUpdatedHandler(List<DirectMessage> updatedDirectMessages);
    public delegate void StatusUpdatedHandler(List<Status> updatedstatus);
    public delegate void MentionsUpdatedHandler(List<Status> updatedstatus);
    public delegate void SearchCompletedHandler(List<IMessage> entries);
    public delegate void ConnectedUserInfoUpdatedHandler(User user);
    public delegate void IMessagesUpdateErrorHandler(Exception exception);
    public delegate void VerifyCredentialCompletedHandler(User user);
    public delegate void UserInfoUpdatedHandler(User user);
    public delegate void TrendsUpdatedHandler(Trends trends);

    public interface ITwitterProvider
    {
        string Login { get; set; }
        string Password { get; set; }
        UserOAuthenSettings CurrentUserOAuthenSettings { get; set; }        

        void UpdateStatus(string status);
        void UpdateStatus(string status, long inReplyToStatusId);
        void UpdateStatusAsync(string status);
        void UpdateStatusAsync(string status, long inReplyToStatusId);
        string SendDirectMessage(string user, string text);        
        List<DirectMessage> GetDirectMessages();
        List<DirectMessage> GetSentDirectMessages();
        List<Status> GetMentions();
        List<Status> GetFriendStatus();
        List<User> GetFollowers(string userScreenName, string cursorId);
        List<User> GetFriends(string userScreenName, string cursorId);
        Tweets GetUserTweets(User user);
        User GetUser(string userScreenName);
        Relationship GetRelationship(User targetUser);
        void VerifyCredential();
        void EndSession();
        void RefreshStatus();
        void RefreshDirectMessages();
        void RefreshMentions();
        void RefreshConnectedUserInfo();
        void RefreshStatus(TimeSpan autoRefreshInterval);
        void RefreshDirectMessages(TimeSpan autoRefreshInterval);
        void RefreshMentions(TimeSpan autoRefreshInterval);
        void RefreshUserInfo(TimeSpan autoRefreshInterval);
        void RefreshTrends();
        void RefreshTrends(TimeSpan autoRefreshInterval);
        void Search(string query);
        void Follow(User userID);
        void UnFollow(User userID);
        void StopAutoRefresh();        
        event DirectMessagesUpdatedHandler DirectMessagesUpdated;
        event StatusUpdatedHandler StatusUpdated;
        event MentionsUpdatedHandler MentionsUpdated;
        event IMessagesUpdateErrorHandler IMessagesUpdateError;
        event SearchCompletedHandler SearchCompleted;
        event ConnectedUserInfoUpdatedHandler ConnectedUserInfoUpdated;
        event VerifyCredentialCompletedHandler VerifyCredentialCompleted;
        event UserInfoUpdatedHandler UserInfoUpdated;
        event TrendsUpdatedHandler TrendsUpdated;
        Exception LastException {get;set;}
        void GetAuthorizationCode();
        UserOAuthenSettings Authorize(string code);
        
    }
}
